<?php /*a:1:{s:61:"D:\web\www\tp5.1\public/../app/admin\view\platform\index.html";i:1526302148;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>平台列表</title>
    <link rel="stylesheet" href="/static/frame/layui/css/layui.css">
    <link rel="stylesheet" href="/static/frame/static/css/style.css">
    <link rel="icon" href="/static/frame/static/image/code.png">
</head>
<body class="body">
<?php if(ahuthbtn('add')): ?>
<div><a class="layui-btn site-demo-active layui-btn-sm" href="<?php echo url('admin/Platform/add'); ?>"><i class="layui-icon">&#xe608;</i>添加平台信息</a></div>
<?php endif; ?>
<table class="layui-table" lay-filter="parse-table-demo" id="test33" style="display:none">
    <thead>
    <tr>
      <th lay-data="{type:'checkbox'}"><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
        <th lay-data="{field:'id', width:80, sort: true}">id</th>
        <th lay-data="{field:'name', width:200 }">名称</th>
        <th lay-data="{field:'contact', minwidth:80, sort: true}">联系人</th>
        <th lay-data="{field:'mobile', minwidth:80, sort: true}">手机</th>
        <th lay-data="{field:'remark', minwidth:80, sort: true}">备注</th>
        <th lay-data="{field:'status', width:100, templet: '#statusTpl', unresize: true}">状态</th>
        <th lay-data="{field: 'right', width:178, align:'center'}">操作</th>
    </tr>
    </thead>
    <tbody>
<?php foreach($list as $key=>$vo): ?>
    <tr>
      <td><input type="checkbox" name="" lay-skin="primary" data-id="<?php echo htmlentities($vo['id']); ?>"></td>
        <td><?php echo htmlentities($vo['id']); ?></td>
        <td><?php echo $vo['name']; ?></td>
        <td><?php echo htmlentities($vo['contact']); ?></td>
        <td><?php echo htmlentities($vo['mobile']); ?></td>
        <td><?php echo htmlentities($vo['remark']); ?></td>
        <td><?php echo htmlentities($vo['status']); ?></td>
        <td>
          <!-- <a data-href="<?php echo url('admin/Partition/add',['id'=>$vo['id']]); ?>" class="addplatform">添加分区</a>  --> 
          <?php if(ahuthbtn('edit')): ?>
          <a data-href="<?php echo url('admin/Platform/edit',['id'=>$vo['id']]); ?>" class="layui-btn layui-btn-xs editplatform"><i class="layui-icon layui-icon-edit"></i></a> 
          <?php endif; if(ahuthbtn('delete')): ?>
          <a data-href="<?php echo url('admin/Platform/delete',['id'=>$vo['id']]); ?>" class="layui-btn layui-btn-danger layui-btn-xs delplatform"><i class="layui-icon layui-icon-delete"></i></a>
          <?php endif; ?>
        </td>
    </tr>
<?php endforeach; ?>
    </tbody>
</table>

<script type="text/html" id="statusTpl">
  <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="禁|否" lay-filter="lockstatus" {{ d.status == 0 ? 'checked' : '' }} >
</script>
<script type="text/javascript" src="/static/frame/layui/layui.js"></script>
<script src="/static/admin/js/comm.js" charset="utf-8"></script>
<script type="text/javascript">
    // you code ...
    layui.use(['form','table','layer','admin'], function(){
      var $ = layui.jquery
          ,form = layui.form
          ,table = layui.table
          ,layer = layui.layer
          ,admin = layui.admin;
    
          table.init('parse-table-demo', { //转化静态表格
            //height: 'full-500'
          }); 
    
    
    $('.addplatform').click(function(event) {
          var url = $(this).attr('data-href');
          admin.actAuth(url,function(){
            window.location.href=url ;
          });
    });
    
    
    $('.delplatform').click(function(event) {
            layer.confirm('真的删除行么-1', function(index){
           var url = $(this).attr('data-href');
            //admin.actAuth(url,function(){
            $.get(url,function(data){
            if (data.code === 0) {
              layer.msg(data.msg);
            }else{
              obj.del();
              layer.msg(data.msg);
            }
            });
    
          });
    });
    
    
    $('.editplatform').click(function(event) {
           var url = $(this).attr('data-href');
          admin.actAuth(url,function(){
            window.location.href=url ;
          });
    });
    
   
      //监听锁定操作
      form.on('switch(lockstatus)', function(obj){
        if(obj.elem.checked === true){
           var isval =0;
        }else{
          var isval =1;
        }
        $.post("<?php echo url('admin/Platform/quickedit'); ?>",{id:this.value,status:isval},function(data,status){
            if(data){
              layer.tips(data.msg,obj.othis);
            }
        });
      });
    
    





});
</script>
</body>
</html>